import java.io.File;
import java.io.IOException;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class Demo1 {
    public static void main(String[] args) {
        File file =new File("D:/code/java-ee.-beginner");
        System.out.println(Arrays.toString(file.list()));
        System.out.println(Arrays.toString(file.listFiles()));
    }
    public static void main3(String[] args) throws IOException {
        File file =new File("./data.txt");
        System.out.println("创造前");
        System.out.println(file.exists());
        System.out.println(file.isFile());
        System.out.println(file.isDirectory());

        System.out.println("创建后");
        System.out.println(file.createNewFile());
        System.out.println("再次创建");
        System.out.println(file.createNewFile());
        System.out.println("标记要删除文件");
        file.deleteOnExit();
        System.out.println(file.exists());
        System.out.println(file.isFile());
        System.out.println(file.isDirectory());

    }
    public static void main2(String[] args) throws IOException {
        File file =new File("./data.txt");
        System.out.println(file.getParent());
        System.out.println(file.getName());
        System.out.println(file.getPath());
        System.out.println(file.getAbsoluteFile());
        System.out.println(file.getCanonicalFile());
    }
    public static void main1(String[] args) throws IOException {
        File file =new File("D:/code/data.txt");
        System.out.println(file.getParent());
        System.out.println(file.getName());
        System.out.println(file.getPath());
        System.out.println(file.getAbsoluteFile());
        System.out.println(file.getCanonicalFile());
    }
}
